"""
Created on 2017年8月2日

@author: xiaoj
"""
import requests


class HtmlDownloader:
    def download(self, url):
        header = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) "
                                "AppleWebKit/537.36 (KHTML, like Gecko)"
                                " Chrome/58.0.3029.110 Safari/537.36"}
        r = requests.get(url, headers=header)
        r.encoding = 'utf-8'
        if r.status_code != requests.codes.ok:
            return None
        return r.text
